package com.vinku.agent.transformer;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;
import java.time.Instant;


/**
 *
 * @author Vinku
 * @date 2023/02/03 17:54
 */
public class SimpleTransformer implements ClassFileTransformer {

    @Override
    public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
        System.out.printf("开始加载 className: %s\n", className);
//        if (className.startsWith("java")) {
//            System.out.println("startsWith java !!!!!");
//        }
        if (className.startsWith("com/vinku/app")) {
            System.out.println("startsWith com/vinku/app !!!!!");
        }
        return classfileBuffer;
    }

}
